{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c664c108-059f-402a-b216-5ba4caa2d98b",
   "metadata": {},
   "source": [
    "## 三大神器概述\n",
    "\n",
    "### 热身练习\n",
    "\n",
    "如下列表保存着本公司从2022年1月到12月五个销售区域（南京、无锡、苏州、徐州、南通）的销售额（以百万元为单位），请利用这些数据完成以下操作：\n",
    "\n",
    "```python\n",
    "sales_month = [f'{i:>2d}月' for i in range(1, 13)]\n",
    "sales_area = ['南京', '无锡', '苏州', '徐州', '南通']\n",
    "sales_data = [\n",
    "    [32, 17, 12, 20, 28],\n",
    "    [41, 30, 17, 15, 35],\n",
    "    [35, 18, 13, 11, 24],\n",
    "    [12, 42, 44, 21, 34],\n",
    "    [29, 11, 42, 32, 50],\n",
    "    [10, 15, 11, 12, 26],\n",
    "    [16, 28, 48, 22, 28],\n",
    "    [31, 40, 45, 30, 39],\n",
    "    [25, 41, 47, 42, 47],\n",
    "    [47, 21, 13, 49, 48],\n",
    "    [41, 36, 17, 36, 22],\n",
    "    [22, 25, 15, 20, 37]\n",
    "]\n",
    "```\n",
    "\n",
    "1. 统计本公司每个月的销售额。\n",
    "2. 统计本公司销售额的月环比。\n",
    "3. 统计每个销售区域全年的销售额。\n",
    "4. 按销售额从高到低排序销售区域及其销售额。\n",
    "5. 统计全年最高的销售额出现在哪个月哪个区域。\n",
    "6. 找出哪个销售区域的业绩最不稳定。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f9d87cfc-deb0-46eb-b98c-2799a4908bc8",
   "metadata": {},
   "outputs": [],
   "source": [
    "sales_month = [f'{i:>2d}月' for i in range(1, 13)]\n",
    "sales_area = ['南京', '无锡', '苏州', '徐州', '南通']\n",
    "sales_data = [\n",
    "    [32, 17, 12, 20, 28],\n",
    "    [41, 30, 17, 15, 35],\n",
    "    [35, 18, 13, 11, 24],\n",
    "    [12, 42, 44, 21, 34],\n",
    "    [29, 11, 42, 32, 50],\n",
    "    [10, 15, 11, 12, 26],\n",
    "    [16, 28, 48, 22, 28],\n",
    "    [31, 40, 45, 30, 39],\n",
    "    [25, 41, 47, 42, 47],\n",
    "    [47, 21, 13, 49, 48],\n",
    "    [41, 36, 17, 36, 22],\n",
    "    [22, 25, 15, 20, 37]\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "dc581dfc-9108-46fa-ace2-60ace650434e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Variable      Type    Data/Info\n",
      "-------------------------------\n",
      "sales_area    list    n=5\n",
      "sales_data    list    n=12\n",
      "sales_month   list    n=12\n"
     ]
    }
   ],
   "source": [
    "# 魔法指令 - %whos - 查看变量\n",
    "%whos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a50e4c3e-6dc1-426f-977b-aef9a5c9a02f",
   "metadata": {},
   "outputs": [],
   "source": [
    "print = 100\n",
    "# TypeError: 'int' object is not callable\n",
    "# print('hello')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4c0b54ca-1556-4a14-9a6a-b6bd6af5d822",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 魔法指令 - %xdel - 删除变量\n",
    "%xdel print"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "fe8eb05f-f45b-491a-b98e-6f6c924997ff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 1月销售额: 109百万\n",
      " 2月销售额: 138百万\n",
      " 3月销售额: 101百万\n",
      " 4月销售额: 153百万\n",
      " 5月销售额: 164百万\n",
      " 6月销售额: 74百万\n",
      " 7月销售额: 142百万\n",
      " 8月销售额: 185百万\n",
      " 9月销售额: 202百万\n",
      "10月销售额: 178百万\n",
      "11月销售额: 152百万\n",
      "12月销售额: 119百万\n"
     ]
    }
   ],
   "source": [
    "# 1. 统计本公司每个月的销售额。\n",
    "monthly_sales = []\n",
    "for i, month in enumerate(sales_month):\n",
    "    monthly_sales.append(sum(sales_data[i]))\n",
    "    print(f'{month}销售额: {monthly_sales[i]}百万')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "53e6bf88-e6a9-4ac9-a7fe-bd1d18ff88f5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 2月: 26.61%\n",
      " 3月: -26.81%\n",
      " 4月: 51.49%\n",
      " 5月: 7.19%\n",
      " 6月: -54.88%\n",
      " 7月: 91.89%\n",
      " 8月: 30.28%\n",
      " 9月: 9.19%\n",
      "10月: -11.88%\n",
      "11月: -14.61%\n",
      "12月: -21.71%\n"
     ]
    }
   ],
   "source": [
    "# 2. 统计本公司销售额的月环比。\n",
    "for i in range(1, len(monthly_sales)):\n",
    "    temp = (monthly_sales[i] - monthly_sales[i - 1]) / monthly_sales[i - 1]\n",
    "    print(f'{sales_month[i]}: {temp:.2%}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f5a130d6-b781-4ee3-a96b-d1fe5e3b4b90",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "南京: 341\n",
      "无锡: 324\n",
      "苏州: 324\n",
      "徐州: 310\n",
      "南通: 418\n"
     ]
    }
   ],
   "source": [
    "# 3. 统计每个销售区域全年的销售额。\n",
    "arealy_sales = {}\n",
    "for j, area in enumerate(sales_area):\n",
    "    temp = [sales_data[i][j] for i in range(len(sales_month))]\n",
    "    arealy_sales[area] = sum(temp)\n",
    "    print(f'{area}: {arealy_sales[area]}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a7bd0510-5e68-4e58-ac3b-6c531f7abccb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "南通: 418\n",
      "南京: 341\n",
      "无锡: 324\n",
      "苏州: 324\n",
      "徐州: 310\n"
     ]
    }
   ],
   "source": [
    "# 4. 按销售额从高到低排序销售区域及其销售额。\n",
    "sorted_keys = sorted(arealy_sales, key=lambda x: arealy_sales[x], reverse=True)\n",
    "for key in sorted_keys:\n",
    "    print(f'{key}: {arealy_sales[key]}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b4b2f3e8-c5c2-481e-b277-9623d30892ac",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 5月 南通\n"
     ]
    }
   ],
   "source": [
    "# 5. 统计全年最高的销售额出现在哪个月哪个区域。\n",
    "max_value = sales_data[0][0]\n",
    "max_i, max_j = 0, 0\n",
    "for i in range(len(sales_month)):\n",
    "    for j in range(len(sales_area)):\n",
    "        temp = sales_data[i][j]\n",
    "        if temp > max_value:\n",
    "            max_value = temp\n",
    "            max_i, max_j = i, j\n",
    "print(sales_month[max_i], sales_area[max_j])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "647d0a87-b672-4e0c-81cc-a3bbb76dca11",
   "metadata": {},
   "source": [
    "总体方差：\n",
    "$$\n",
    "\\sigma^{2} = \\frac{1}{N} \\sum_{i=1}^{N}(x_{i} - \\mu)^{2}\n",
    "$$\n",
    "\n",
    "样本方差：\n",
    "$$\n",
    "s^{2} = \\frac{1}{n - 1} \\sum_{i=1}^{n}(x_{i} - \\bar{x})^{2}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b43fb247-32fc-4e10-a9ee-488fd1f56a9a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'苏州'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 6. 找出哪个销售区域的业绩最不稳定。\n",
    "import statistics as stats\n",
    "\n",
    "arealy_vars = []\n",
    "for j, area in enumerate(sales_area):\n",
    "    temp = [sales_data[i][j] for i in range(len(sales_month))]\n",
    "    arealy_vars.append(stats.pvariance(temp))\n",
    "sales_area[arealy_vars.index(max(arealy_vars))]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3ea677d0-7a33-43e5-b10b-ddfcb82f7f6a",
   "metadata": {},
   "source": [
    "### 三大神器\n",
    "\n",
    "1. numpy - Numerical Python - 核心是`ndarray`类型，可以用来表示N维数组，提供了一系列处理数据的运算、函数和方法。\n",
    "2. pandas - Panel Data Set - 封装了和数据分析（加载、重塑、清洗、预处理、透视、呈现）相关的类型、函数和诸多的方法，为数据分析提供了一站式解决方案。它的核心有三个数据类型，分别是：`Series`、`DataFrame`、`Index`。\n",
    "3. matplotlib - 封装了各种常用的统计图表，帮助我们实现数据呈现。\n",
    "4. scipy - Scientific Python - 针对NumPy进行了很好的补充，提供了高级的数据运算的函数和方法。\n",
    "5. scikit-learn - 封装了常用的机器学习（分类、聚类、回归等）算法，除此之外，还提供了数据预处理、特征工程、模型验证相关的函数和方法。\n",
    "6. sympy - Symbolic Python - 封装了符号运算相关操作。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0db758cc-d83c-47c4-9a0b-c7ef5abd6c18",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 魔法指令 - %pip - 调用包管理工具pip\n",
    "# %pip install numpy pandas matplotlib openpyxl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "8eb6970b-3907-4b84-af60-67cbf67f2e74",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams['font.sans-serif'].insert(0, 'SimHei')\n",
    "plt.rcParams['axes.unicode_minus'] = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5fb76dec-cd51-4e79-9bd2-3b210ae20522",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.26.4'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e6369df9-7577-496c-bfc1-2fce096c0162",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2.2.3'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "eb5733cd-38f7-4afd-b45b-70c1439ab36b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[32, 17, 12, 20, 28],\n",
       "       [41, 30, 17, 15, 35],\n",
       "       [35, 18, 13, 11, 24],\n",
       "       [12, 42, 44, 21, 34],\n",
       "       [29, 11, 42, 32, 50],\n",
       "       [10, 15, 11, 12, 26],\n",
       "       [16, 28, 48, 22, 28],\n",
       "       [31, 40, 45, 30, 39],\n",
       "       [25, 41, 47, 42, 47],\n",
       "       [47, 21, 13, 49, 48],\n",
       "       [41, 36, 17, 36, 22],\n",
       "       [22, 25, 15, 20, 37]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将嵌套列表处理成二维数组\n",
    "data = np.array(sales_data)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "da304104-8cf0-4425-b3b4-dcb148ac4b3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([109, 138, 101, 153, 164,  74, 142, 185, 202, 178, 152, 119])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 沿着1轴求和（每个月的销售额）\n",
    "data.sum(axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "1507ac63-f53b-4e36-a7fb-b9c636fd81ea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([341, 324, 324, 310, 418])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 沿着0轴求和（每个区域的销售）\n",
    "data.sum(axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "26be450d-44ba-4d83-9351-c52a13c2c338",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([128.4, 108.5, 241.3, 132.6,  85.6])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 总体方差\n",
    "data.var(axis=0).round(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "81e5b2a0-c86e-4720-909f-ce8b1b6fdd58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([140.1, 118.4, 263.3, 144.7,  93.4])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 样本方差\n",
    "data.var(axis=0, ddof=1).round(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "ba4e0f0a-e711-4041-8834-1e3be86ce8a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>南京</th>\n",
       "      <th>无锡</th>\n",
       "      <th>苏州</th>\n",
       "      <th>徐州</th>\n",
       "      <th>南通</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1月</th>\n",
       "      <td>32</td>\n",
       "      <td>17</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2月</th>\n",
       "      <td>41</td>\n",
       "      <td>30</td>\n",
       "      <td>17</td>\n",
       "      <td>15</td>\n",
       "      <td>35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3月</th>\n",
       "      <td>35</td>\n",
       "      <td>18</td>\n",
       "      <td>13</td>\n",
       "      <td>11</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4月</th>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>44</td>\n",
       "      <td>21</td>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5月</th>\n",
       "      <td>29</td>\n",
       "      <td>11</td>\n",
       "      <td>42</td>\n",
       "      <td>32</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6月</th>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>11</td>\n",
       "      <td>12</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7月</th>\n",
       "      <td>16</td>\n",
       "      <td>28</td>\n",
       "      <td>48</td>\n",
       "      <td>22</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8月</th>\n",
       "      <td>31</td>\n",
       "      <td>40</td>\n",
       "      <td>45</td>\n",
       "      <td>30</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9月</th>\n",
       "      <td>25</td>\n",
       "      <td>41</td>\n",
       "      <td>47</td>\n",
       "      <td>42</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10月</th>\n",
       "      <td>47</td>\n",
       "      <td>21</td>\n",
       "      <td>13</td>\n",
       "      <td>49</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11月</th>\n",
       "      <td>41</td>\n",
       "      <td>36</td>\n",
       "      <td>17</td>\n",
       "      <td>36</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12月</th>\n",
       "      <td>22</td>\n",
       "      <td>25</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     南京  无锡  苏州  徐州  南通\n",
       " 1月  32  17  12  20  28\n",
       " 2月  41  30  17  15  35\n",
       " 3月  35  18  13  11  24\n",
       " 4月  12  42  44  21  34\n",
       " 5月  29  11  42  32  50\n",
       " 6月  10  15  11  12  26\n",
       " 7月  16  28  48  22  28\n",
       " 8月  31  40  45  30  39\n",
       " 9月  25  41  47  42  47\n",
       "10月  47  21  13  49  48\n",
       "11月  41  36  17  36  22\n",
       "12月  22  25  15  20  37"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 构造DataFrame对象（处理二维数据）\n",
    "df = pd.DataFrame(data, columns=sales_area, index=sales_month)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "9d1a6a43-6dfc-41e3-98c8-be2681e0d547",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "南京    341\n",
       "无锡    324\n",
       "苏州    324\n",
       "徐州    310\n",
       "南通    418\n",
       "dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 求和（默认沿着0轴）\n",
    "df.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a478ec0e-499f-4e31-b8c2-ba45e691b834",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "南通    418\n",
       "南京    341\n",
       "无锡    324\n",
       "苏州    324\n",
       "徐州    310\n",
       "dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 排序\n",
    "df.sum().sort_values(ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "6f221833-855c-45ad-91b2-e3f4da627704",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       " 1月    109\n",
       " 2月    138\n",
       " 3月    101\n",
       " 4月    153\n",
       " 5月    164\n",
       " 6月     74\n",
       " 7月    142\n",
       " 8月    185\n",
       " 9月    202\n",
       "10月    178\n",
       "11月    152\n",
       "12月    119\n",
       "dtype: int64"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 求和（指定沿着1轴）\n",
    "df.sum(axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "80df8865-4ea0-4c72-a581-215cd953cfbe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       " 1月         NaN\n",
       " 2月    0.266055\n",
       " 3月   -0.268116\n",
       " 4月    0.514851\n",
       " 5月    0.071895\n",
       " 6月   -0.548780\n",
       " 7月    0.918919\n",
       " 8月    0.302817\n",
       " 9月    0.091892\n",
       "10月   -0.118812\n",
       "11月   -0.146067\n",
       "12月   -0.217105\n",
       "dtype: float64"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 计算月环比\n",
    "df.sum(axis=1).pct_change()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ea4579c3-11cd-4179-9c96-8dbe9a033da2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>南京</th>\n",
       "      <th>无锡</th>\n",
       "      <th>苏州</th>\n",
       "      <th>徐州</th>\n",
       "      <th>南通</th>\n",
       "      <th>合计</th>\n",
       "      <th>月环比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1月</th>\n",
       "      <td>32</td>\n",
       "      <td>17</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "      <td>28</td>\n",
       "      <td>109</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2月</th>\n",
       "      <td>41</td>\n",
       "      <td>30</td>\n",
       "      <td>17</td>\n",
       "      <td>15</td>\n",
       "      <td>35</td>\n",
       "      <td>138</td>\n",
       "      <td>0.266055</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3月</th>\n",
       "      <td>35</td>\n",
       "      <td>18</td>\n",
       "      <td>13</td>\n",
       "      <td>11</td>\n",
       "      <td>24</td>\n",
       "      <td>101</td>\n",
       "      <td>-0.268116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4月</th>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>44</td>\n",
       "      <td>21</td>\n",
       "      <td>34</td>\n",
       "      <td>153</td>\n",
       "      <td>0.514851</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5月</th>\n",
       "      <td>29</td>\n",
       "      <td>11</td>\n",
       "      <td>42</td>\n",
       "      <td>32</td>\n",
       "      <td>50</td>\n",
       "      <td>164</td>\n",
       "      <td>0.071895</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6月</th>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>11</td>\n",
       "      <td>12</td>\n",
       "      <td>26</td>\n",
       "      <td>74</td>\n",
       "      <td>-0.548780</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7月</th>\n",
       "      <td>16</td>\n",
       "      <td>28</td>\n",
       "      <td>48</td>\n",
       "      <td>22</td>\n",
       "      <td>28</td>\n",
       "      <td>142</td>\n",
       "      <td>0.918919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8月</th>\n",
       "      <td>31</td>\n",
       "      <td>40</td>\n",
       "      <td>45</td>\n",
       "      <td>30</td>\n",
       "      <td>39</td>\n",
       "      <td>185</td>\n",
       "      <td>0.302817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9月</th>\n",
       "      <td>25</td>\n",
       "      <td>41</td>\n",
       "      <td>47</td>\n",
       "      <td>42</td>\n",
       "      <td>47</td>\n",
       "      <td>202</td>\n",
       "      <td>0.091892</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10月</th>\n",
       "      <td>47</td>\n",
       "      <td>21</td>\n",
       "      <td>13</td>\n",
       "      <td>49</td>\n",
       "      <td>48</td>\n",
       "      <td>178</td>\n",
       "      <td>-0.118812</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11月</th>\n",
       "      <td>41</td>\n",
       "      <td>36</td>\n",
       "      <td>17</td>\n",
       "      <td>36</td>\n",
       "      <td>22</td>\n",
       "      <td>152</td>\n",
       "      <td>-0.146067</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12月</th>\n",
       "      <td>22</td>\n",
       "      <td>25</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>37</td>\n",
       "      <td>119</td>\n",
       "      <td>-0.217105</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     南京  无锡  苏州  徐州  南通   合计       月环比\n",
       " 1月  32  17  12  20  28  109       NaN\n",
       " 2月  41  30  17  15  35  138  0.266055\n",
       " 3月  35  18  13  11  24  101 -0.268116\n",
       " 4月  12  42  44  21  34  153  0.514851\n",
       " 5月  29  11  42  32  50  164  0.071895\n",
       " 6月  10  15  11  12  26   74 -0.548780\n",
       " 7月  16  28  48  22  28  142  0.918919\n",
       " 8月  31  40  45  30  39  185  0.302817\n",
       " 9月  25  41  47  42  47  202  0.091892\n",
       "10月  47  21  13  49  48  178 -0.118812\n",
       "11月  41  36  17  36  22  152 -0.146067\n",
       "12月  22  25  15  20  37  119 -0.217105"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['合计'] = df.sum(axis=1)\n",
    "df['月环比'] = df['合计'].pct_change()\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "3c660052-dded-4a0a-8b72-7747d3cae816",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_59145_row0_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 54.0%, transparent 54.0%);\n",
       "}\n",
       "#T_59145_row0_col6 {\n",
       "  background-color: #000000;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_59145_row1_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 68.3%, transparent 68.3%);\n",
       "}\n",
       "#T_59145_row1_col6 {\n",
       "  background-color: #edf8df;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row2_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 50.0%, transparent 50.0%);\n",
       "}\n",
       "#T_59145_row2_col6 {\n",
       "  background-color: #f16640;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_59145_row3_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 75.7%, transparent 75.7%);\n",
       "}\n",
       "#T_59145_row3_col6 {\n",
       "  background-color: #9dcee3;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row4_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 81.2%, transparent 81.2%);\n",
       "}\n",
       "#T_59145_row4_col6 {\n",
       "  background-color: #fee79b;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row5_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 36.6%, transparent 36.6%);\n",
       "}\n",
       "#T_59145_row5_col6 {\n",
       "  background-color: #a50026;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_59145_row6_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 70.3%, transparent 70.3%);\n",
       "}\n",
       "#T_59145_row6_col6 {\n",
       "  background-color: #313695;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_59145_row7_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 91.6%, transparent 91.6%);\n",
       "}\n",
       "#T_59145_row7_col6 {\n",
       "  background-color: #e6f5ed;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row8_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_59145_row8_col6 {\n",
       "  background-color: #feeba1;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row9_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 88.1%, transparent 88.1%);\n",
       "}\n",
       "#T_59145_row9_col6 {\n",
       "  background-color: #fca85e;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row10_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 75.2%, transparent 75.2%);\n",
       "}\n",
       "#T_59145_row10_col6 {\n",
       "  background-color: #fb9d59;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_59145_row11_col5 {\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #d65f5f 58.9%, transparent 58.9%);\n",
       "}\n",
       "#T_59145_row11_col6 {\n",
       "  background-color: #f67c4a;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_59145\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_59145_level0_col0\" class=\"col_heading level0 col0\" >南京</th>\n",
       "      <th id=\"T_59145_level0_col1\" class=\"col_heading level0 col1\" >无锡</th>\n",
       "      <th id=\"T_59145_level0_col2\" class=\"col_heading level0 col2\" >苏州</th>\n",
       "      <th id=\"T_59145_level0_col3\" class=\"col_heading level0 col3\" >徐州</th>\n",
       "      <th id=\"T_59145_level0_col4\" class=\"col_heading level0 col4\" >南通</th>\n",
       "      <th id=\"T_59145_level0_col5\" class=\"col_heading level0 col5\" >合计</th>\n",
       "      <th id=\"T_59145_level0_col6\" class=\"col_heading level0 col6\" >月环比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row0\" class=\"row_heading level0 row0\" > 1月</th>\n",
       "      <td id=\"T_59145_row0_col0\" class=\"data row0 col0\" >32</td>\n",
       "      <td id=\"T_59145_row0_col1\" class=\"data row0 col1\" >17</td>\n",
       "      <td id=\"T_59145_row0_col2\" class=\"data row0 col2\" >12</td>\n",
       "      <td id=\"T_59145_row0_col3\" class=\"data row0 col3\" >20</td>\n",
       "      <td id=\"T_59145_row0_col4\" class=\"data row0 col4\" >28</td>\n",
       "      <td id=\"T_59145_row0_col5\" class=\"data row0 col5\" >109</td>\n",
       "      <td id=\"T_59145_row0_col6\" class=\"data row0 col6\" >------</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row1\" class=\"row_heading level0 row1\" > 2月</th>\n",
       "      <td id=\"T_59145_row1_col0\" class=\"data row1 col0\" >41</td>\n",
       "      <td id=\"T_59145_row1_col1\" class=\"data row1 col1\" >30</td>\n",
       "      <td id=\"T_59145_row1_col2\" class=\"data row1 col2\" >17</td>\n",
       "      <td id=\"T_59145_row1_col3\" class=\"data row1 col3\" >15</td>\n",
       "      <td id=\"T_59145_row1_col4\" class=\"data row1 col4\" >35</td>\n",
       "      <td id=\"T_59145_row1_col5\" class=\"data row1 col5\" >138</td>\n",
       "      <td id=\"T_59145_row1_col6\" class=\"data row1 col6\" >26.61%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row2\" class=\"row_heading level0 row2\" > 3月</th>\n",
       "      <td id=\"T_59145_row2_col0\" class=\"data row2 col0\" >35</td>\n",
       "      <td id=\"T_59145_row2_col1\" class=\"data row2 col1\" >18</td>\n",
       "      <td id=\"T_59145_row2_col2\" class=\"data row2 col2\" >13</td>\n",
       "      <td id=\"T_59145_row2_col3\" class=\"data row2 col3\" >11</td>\n",
       "      <td id=\"T_59145_row2_col4\" class=\"data row2 col4\" >24</td>\n",
       "      <td id=\"T_59145_row2_col5\" class=\"data row2 col5\" >101</td>\n",
       "      <td id=\"T_59145_row2_col6\" class=\"data row2 col6\" >-26.81%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row3\" class=\"row_heading level0 row3\" > 4月</th>\n",
       "      <td id=\"T_59145_row3_col0\" class=\"data row3 col0\" >12</td>\n",
       "      <td id=\"T_59145_row3_col1\" class=\"data row3 col1\" >42</td>\n",
       "      <td id=\"T_59145_row3_col2\" class=\"data row3 col2\" >44</td>\n",
       "      <td id=\"T_59145_row3_col3\" class=\"data row3 col3\" >21</td>\n",
       "      <td id=\"T_59145_row3_col4\" class=\"data row3 col4\" >34</td>\n",
       "      <td id=\"T_59145_row3_col5\" class=\"data row3 col5\" >153</td>\n",
       "      <td id=\"T_59145_row3_col6\" class=\"data row3 col6\" >51.49%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row4\" class=\"row_heading level0 row4\" > 5月</th>\n",
       "      <td id=\"T_59145_row4_col0\" class=\"data row4 col0\" >29</td>\n",
       "      <td id=\"T_59145_row4_col1\" class=\"data row4 col1\" >11</td>\n",
       "      <td id=\"T_59145_row4_col2\" class=\"data row4 col2\" >42</td>\n",
       "      <td id=\"T_59145_row4_col3\" class=\"data row4 col3\" >32</td>\n",
       "      <td id=\"T_59145_row4_col4\" class=\"data row4 col4\" >50</td>\n",
       "      <td id=\"T_59145_row4_col5\" class=\"data row4 col5\" >164</td>\n",
       "      <td id=\"T_59145_row4_col6\" class=\"data row4 col6\" >7.19%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row5\" class=\"row_heading level0 row5\" > 6月</th>\n",
       "      <td id=\"T_59145_row5_col0\" class=\"data row5 col0\" >10</td>\n",
       "      <td id=\"T_59145_row5_col1\" class=\"data row5 col1\" >15</td>\n",
       "      <td id=\"T_59145_row5_col2\" class=\"data row5 col2\" >11</td>\n",
       "      <td id=\"T_59145_row5_col3\" class=\"data row5 col3\" >12</td>\n",
       "      <td id=\"T_59145_row5_col4\" class=\"data row5 col4\" >26</td>\n",
       "      <td id=\"T_59145_row5_col5\" class=\"data row5 col5\" >74</td>\n",
       "      <td id=\"T_59145_row5_col6\" class=\"data row5 col6\" >-54.88%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row6\" class=\"row_heading level0 row6\" > 7月</th>\n",
       "      <td id=\"T_59145_row6_col0\" class=\"data row6 col0\" >16</td>\n",
       "      <td id=\"T_59145_row6_col1\" class=\"data row6 col1\" >28</td>\n",
       "      <td id=\"T_59145_row6_col2\" class=\"data row6 col2\" >48</td>\n",
       "      <td id=\"T_59145_row6_col3\" class=\"data row6 col3\" >22</td>\n",
       "      <td id=\"T_59145_row6_col4\" class=\"data row6 col4\" >28</td>\n",
       "      <td id=\"T_59145_row6_col5\" class=\"data row6 col5\" >142</td>\n",
       "      <td id=\"T_59145_row6_col6\" class=\"data row6 col6\" >91.89%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row7\" class=\"row_heading level0 row7\" > 8月</th>\n",
       "      <td id=\"T_59145_row7_col0\" class=\"data row7 col0\" >31</td>\n",
       "      <td id=\"T_59145_row7_col1\" class=\"data row7 col1\" >40</td>\n",
       "      <td id=\"T_59145_row7_col2\" class=\"data row7 col2\" >45</td>\n",
       "      <td id=\"T_59145_row7_col3\" class=\"data row7 col3\" >30</td>\n",
       "      <td id=\"T_59145_row7_col4\" class=\"data row7 col4\" >39</td>\n",
       "      <td id=\"T_59145_row7_col5\" class=\"data row7 col5\" >185</td>\n",
       "      <td id=\"T_59145_row7_col6\" class=\"data row7 col6\" >30.28%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row8\" class=\"row_heading level0 row8\" > 9月</th>\n",
       "      <td id=\"T_59145_row8_col0\" class=\"data row8 col0\" >25</td>\n",
       "      <td id=\"T_59145_row8_col1\" class=\"data row8 col1\" >41</td>\n",
       "      <td id=\"T_59145_row8_col2\" class=\"data row8 col2\" >47</td>\n",
       "      <td id=\"T_59145_row8_col3\" class=\"data row8 col3\" >42</td>\n",
       "      <td id=\"T_59145_row8_col4\" class=\"data row8 col4\" >47</td>\n",
       "      <td id=\"T_59145_row8_col5\" class=\"data row8 col5\" >202</td>\n",
       "      <td id=\"T_59145_row8_col6\" class=\"data row8 col6\" >9.19%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row9\" class=\"row_heading level0 row9\" >10月</th>\n",
       "      <td id=\"T_59145_row9_col0\" class=\"data row9 col0\" >47</td>\n",
       "      <td id=\"T_59145_row9_col1\" class=\"data row9 col1\" >21</td>\n",
       "      <td id=\"T_59145_row9_col2\" class=\"data row9 col2\" >13</td>\n",
       "      <td id=\"T_59145_row9_col3\" class=\"data row9 col3\" >49</td>\n",
       "      <td id=\"T_59145_row9_col4\" class=\"data row9 col4\" >48</td>\n",
       "      <td id=\"T_59145_row9_col5\" class=\"data row9 col5\" >178</td>\n",
       "      <td id=\"T_59145_row9_col6\" class=\"data row9 col6\" >-11.88%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row10\" class=\"row_heading level0 row10\" >11月</th>\n",
       "      <td id=\"T_59145_row10_col0\" class=\"data row10 col0\" >41</td>\n",
       "      <td id=\"T_59145_row10_col1\" class=\"data row10 col1\" >36</td>\n",
       "      <td id=\"T_59145_row10_col2\" class=\"data row10 col2\" >17</td>\n",
       "      <td id=\"T_59145_row10_col3\" class=\"data row10 col3\" >36</td>\n",
       "      <td id=\"T_59145_row10_col4\" class=\"data row10 col4\" >22</td>\n",
       "      <td id=\"T_59145_row10_col5\" class=\"data row10 col5\" >152</td>\n",
       "      <td id=\"T_59145_row10_col6\" class=\"data row10 col6\" >-14.61%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_59145_level0_row11\" class=\"row_heading level0 row11\" >12月</th>\n",
       "      <td id=\"T_59145_row11_col0\" class=\"data row11 col0\" >22</td>\n",
       "      <td id=\"T_59145_row11_col1\" class=\"data row11 col1\" >25</td>\n",
       "      <td id=\"T_59145_row11_col2\" class=\"data row11 col2\" >15</td>\n",
       "      <td id=\"T_59145_row11_col3\" class=\"data row11 col3\" >20</td>\n",
       "      <td id=\"T_59145_row11_col4\" class=\"data row11 col4\" >37</td>\n",
       "      <td id=\"T_59145_row11_col5\" class=\"data row11 col5\" >119</td>\n",
       "      <td id=\"T_59145_row11_col6\" class=\"data row11 col6\" >-21.71%</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x105dddbb0>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 渲染DataFrame\n",
    "df.style.format(\n",
    "    formatter={'月环比': '{:.2%}'},\n",
    "    na_rep='------'\n",
    ").bar(\n",
    "    subset='合计'\n",
    ").background_gradient(\n",
    "    'RdYlBu', subset='月环比'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "a092c12c-dab6-4272-b1cd-5218998fcd90",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将DataFrame输出到Excel文件\n",
    "df.to_excel('sales.xlsx', sheet_name='data')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "54c3f505-e866-4c4e-a3f8-f55a71a95c3f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 魔法指令 - %config - 修改配置\n",
    "# %config InlineBackend.figure_format = 'svg'\n",
    "get_ipython().run_line_magic('config', 'InlineBackend.figure_format = \"svg\"')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "3951055d-d5d2-4e4e-bbe7-a1b40a6731e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"482.8pt\" height=\"251.5975pt\" viewBox=\"0 0 482.8 251.5975\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2025-03-04T16:45:31.830094</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.9.4, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 251.5975 \n",
       "L 482.8 251.5975 \n",
       "L 482.8 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 29.2 228.96 \n",
       "L 475.6 228.96 \n",
       "L 475.6 7.2 \n",
       "L 29.2 7.2 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 38.5 228.96 \n",
       "L 57.1 228.96 \n",
       "L 57.1 114.995644 \n",
       "L 38.5 114.995644 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 75.7 228.96 \n",
       "L 94.3 228.96 \n",
       "L 94.3 84.674851 \n",
       "L 75.7 84.674851 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 112.9 228.96 \n",
       "L 131.5 228.96 \n",
       "L 131.5 123.36 \n",
       "L 112.9 123.36 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 150.1 228.96 \n",
       "L 168.7 228.96 \n",
       "L 168.7 68.991683 \n",
       "L 150.1 68.991683 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 187.3 228.96 \n",
       "L 205.9 228.96 \n",
       "L 205.9 57.490693 \n",
       "L 187.3 57.490693 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 224.5 228.96 \n",
       "L 243.1 228.96 \n",
       "L 243.1 151.589703 \n",
       "L 224.5 151.589703 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 261.7 228.96 \n",
       "L 280.3 228.96 \n",
       "L 280.3 80.492673 \n",
       "L 261.7 80.492673 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 298.9 228.96 \n",
       "L 317.5 228.96 \n",
       "L 317.5 35.534257 \n",
       "L 298.9 35.534257 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 336.1 228.96 \n",
       "L 354.7 228.96 \n",
       "L 354.7 17.76 \n",
       "L 336.1 17.76 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 373.3 228.96 \n",
       "L 391.9 228.96 \n",
       "L 391.9 42.853069 \n",
       "L 373.3 42.853069 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_13\">\n",
       "    <path d=\"M 410.5 228.96 \n",
       "L 429.1 228.96 \n",
       "L 429.1 70.037228 \n",
       "L 410.5 70.037228 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_14\">\n",
       "    <path d=\"M 447.7 228.96 \n",
       "L 466.3 228.96 \n",
       "L 466.3 104.540198 \n",
       "L 447.7 104.540198 \n",
       "z\n",
       "\" clip-path=\"url(#pc95f63a0a0)\" style=\"fill: #1f77b4\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path id=\"m31a22ed532\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"47.8\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!--  1月 -->\n",
       "      <g transform=\"translate(37.8 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-20\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"SimHei-31\" d=\"M 1950 100 \n",
       "L 1375 100 \n",
       "L 1375 3425 \n",
       "L 625 3425 \n",
       "L 625 3725 \n",
       "Q 1075 3725 1325 3900 \n",
       "Q 1575 4075 1650 4425 \n",
       "L 1950 4425 \n",
       "L 1950 100 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"SimHei-6708\" d=\"M 2075 4375 \n",
       "L 2075 3375 \n",
       "L 4575 3375 \n",
       "L 4575 4375 \n",
       "L 2075 4375 \n",
       "z\n",
       "M 2075 2975 \n",
       "L 2075 1975 \n",
       "L 4575 1975 \n",
       "L 4575 2975 \n",
       "L 2075 2975 \n",
       "z\n",
       "M 1550 4775 \n",
       "L 5100 4775 \n",
       "Q 5075 4175 5075 3700 \n",
       "L 5075 200 \n",
       "Q 5075 -275 4837 -387 \n",
       "Q 4600 -500 4100 -575 \n",
       "Q 4050 -225 3875 75 \n",
       "Q 4225 50 4400 62 \n",
       "Q 4575 75 4575 375 \n",
       "L 4575 1575 \n",
       "L 2050 1575 \n",
       "Q 2025 1275 1950 975 \n",
       "Q 1875 675 1750 387 \n",
       "Q 1625 100 1475 -162 \n",
       "Q 1325 -425 1125 -625 \n",
       "Q 900 -400 625 -300 \n",
       "Q 1000 50 1225 512 \n",
       "Q 1450 975 1525 1450 \n",
       "Q 1600 1925 1587 2487 \n",
       "Q 1575 3050 1575 3587 \n",
       "Q 1575 4125 1550 4775 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-31\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"85\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!--  2月 -->\n",
       "      <g transform=\"translate(75 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-32\" d=\"M 2850 100 \n",
       "L 300 100 \n",
       "L 300 500 \n",
       "Q 450 900 712 1237 \n",
       "Q 975 1575 1475 2000 \n",
       "Q 1850 2325 2012 2600 \n",
       "Q 2175 2875 2175 3200 \n",
       "Q 2175 3525 2037 3737 \n",
       "Q 1900 3950 1600 3950 \n",
       "Q 1350 3950 1162 3725 \n",
       "Q 975 3500 975 2925 \n",
       "L 400 2925 \n",
       "Q 425 3650 737 4037 \n",
       "Q 1050 4425 1625 4425 \n",
       "Q 2175 4425 2475 4087 \n",
       "Q 2775 3750 2775 3175 \n",
       "Q 2775 2700 2500 2350 \n",
       "Q 2225 2000 1825 1650 \n",
       "Q 1375 1250 1200 1050 \n",
       "Q 1025 850 875 575 \n",
       "L 2850 575 \n",
       "L 2850 100 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"122.2\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!--  3月 -->\n",
       "      <g transform=\"translate(112.2 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-33\" d=\"M 2825 1300 \n",
       "Q 2825 725 2462 387 \n",
       "Q 2100 50 1550 50 \n",
       "Q 1000 50 637 387 \n",
       "Q 275 725 275 1425 \n",
       "L 850 1425 \n",
       "Q 850 950 1037 737 \n",
       "Q 1225 525 1550 525 \n",
       "Q 1875 525 2050 725 \n",
       "Q 2225 925 2225 1350 \n",
       "Q 2225 1700 2037 1900 \n",
       "Q 1850 2100 1375 2100 \n",
       "L 1375 2525 \n",
       "Q 1775 2525 1962 2725 \n",
       "Q 2150 2925 2150 3325 \n",
       "Q 2150 3625 2012 3800 \n",
       "Q 1875 3975 1575 3975 \n",
       "Q 1275 3975 1112 3762 \n",
       "Q 950 3550 925 3150 \n",
       "L 375 3150 \n",
       "Q 425 3725 737 4075 \n",
       "Q 1050 4425 1575 4425 \n",
       "Q 2125 4425 2425 4112 \n",
       "Q 2725 3800 2725 3350 \n",
       "Q 2725 2925 2575 2687 \n",
       "Q 2425 2450 2075 2325 \n",
       "Q 2425 2250 2625 1975 \n",
       "Q 2825 1700 2825 1300 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-33\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"159.4\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!--  4月 -->\n",
       "      <g transform=\"translate(149.4 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-34\" d=\"M 2975 1200 \n",
       "L 2450 1200 \n",
       "L 2450 100 \n",
       "L 1875 100 \n",
       "L 1875 1200 \n",
       "L 200 1200 \n",
       "L 200 1675 \n",
       "L 1875 4425 \n",
       "L 2450 4425 \n",
       "L 2450 1675 \n",
       "L 2975 1675 \n",
       "L 2975 1200 \n",
       "z\n",
       "M 1875 1675 \n",
       "L 1875 3525 \n",
       "L 750 1675 \n",
       "L 1875 1675 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"196.6\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!--  5月 -->\n",
       "      <g transform=\"translate(186.6 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-35\" d=\"M 2825 1650 \n",
       "Q 2825 900 2462 475 \n",
       "Q 2100 50 1500 50 \n",
       "Q 975 50 637 400 \n",
       "Q 300 750 275 1350 \n",
       "L 850 1350 \n",
       "Q 850 975 1025 750 \n",
       "Q 1200 525 1525 525 \n",
       "Q 1850 525 2037 800 \n",
       "Q 2225 1075 2225 1650 \n",
       "Q 2225 2150 2062 2387 \n",
       "Q 1900 2625 1625 2625 \n",
       "Q 1400 2625 1237 2525 \n",
       "Q 1075 2425 925 2175 \n",
       "L 425 2175 \n",
       "L 575 4375 \n",
       "L 2725 4375 \n",
       "L 2725 3900 \n",
       "L 1050 3900 \n",
       "L 950 2750 \n",
       "Q 1100 2900 1275 2975 \n",
       "Q 1450 3050 1750 3050 \n",
       "Q 2225 3050 2525 2687 \n",
       "Q 2825 2325 2825 1650 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"233.8\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!--  6月 -->\n",
       "      <g transform=\"translate(223.8 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-36\" d=\"M 2850 1550 \n",
       "Q 2850 850 2550 450 \n",
       "Q 2250 50 1650 50 \n",
       "Q 1050 50 700 550 \n",
       "Q 350 1050 350 2175 \n",
       "Q 350 3200 712 3812 \n",
       "Q 1075 4425 1750 4425 \n",
       "Q 2225 4425 2512 4075 \n",
       "Q 2800 3725 2800 3300 \n",
       "L 2225 3300 \n",
       "Q 2225 3550 2087 3750 \n",
       "Q 1950 3950 1725 3950 \n",
       "Q 1350 3950 1150 3562 \n",
       "Q 950 3175 925 2375 \n",
       "Q 1100 2700 1300 2825 \n",
       "Q 1500 2950 1775 2950 \n",
       "Q 2250 2950 2550 2575 \n",
       "Q 2850 2200 2850 1550 \n",
       "z\n",
       "M 2250 1550 \n",
       "Q 2250 2000 2100 2250 \n",
       "Q 1950 2500 1675 2500 \n",
       "Q 1350 2500 1162 2250 \n",
       "Q 975 2000 975 1650 \n",
       "Q 975 1100 1162 800 \n",
       "Q 1350 500 1675 500 \n",
       "Q 1900 500 2075 725 \n",
       "Q 2250 950 2250 1550 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"271\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!--  7月 -->\n",
       "      <g transform=\"translate(261 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-37\" d=\"M 2775 3850 \n",
       "L 1600 100 \n",
       "L 1025 100 \n",
       "L 2225 3900 \n",
       "L 400 3900 \n",
       "L 400 4375 \n",
       "L 2775 4375 \n",
       "L 2775 3850 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-37\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"308.2\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!--  8月 -->\n",
       "      <g transform=\"translate(298.2 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-38\" d=\"M 2875 1325 \n",
       "Q 2875 700 2525 375 \n",
       "Q 2175 50 1575 50 \n",
       "Q 975 50 625 375 \n",
       "Q 275 700 275 1325 \n",
       "Q 275 1650 475 1912 \n",
       "Q 675 2175 1025 2300 \n",
       "Q 725 2425 562 2650 \n",
       "Q 400 2875 400 3225 \n",
       "Q 400 3775 750 4100 \n",
       "Q 1100 4425 1575 4425 \n",
       "Q 2050 4425 2400 4100 \n",
       "Q 2750 3775 2750 3225 \n",
       "Q 2750 2875 2587 2650 \n",
       "Q 2425 2425 2125 2300 \n",
       "Q 2475 2175 2675 1912 \n",
       "Q 2875 1650 2875 1325 \n",
       "z\n",
       "M 2200 3225 \n",
       "Q 2200 3625 2025 3800 \n",
       "Q 1850 3975 1575 3975 \n",
       "Q 1300 3975 1125 3800 \n",
       "Q 950 3625 950 3225 \n",
       "Q 950 2825 1137 2662 \n",
       "Q 1325 2500 1575 2500 \n",
       "Q 1825 2500 2012 2662 \n",
       "Q 2200 2825 2200 3225 \n",
       "z\n",
       "M 2300 1325 \n",
       "Q 2300 1675 2112 1875 \n",
       "Q 1925 2075 1575 2075 \n",
       "Q 1225 2075 1037 1875 \n",
       "Q 850 1675 850 1325 \n",
       "Q 850 925 1050 712 \n",
       "Q 1250 500 1575 500 \n",
       "Q 1900 500 2100 712 \n",
       "Q 2300 925 2300 1325 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"345.4\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!--  9月 -->\n",
       "      <g transform=\"translate(335.4 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-39\" d=\"M 2825 2300 \n",
       "Q 2825 1275 2462 662 \n",
       "Q 2100 50 1425 50 \n",
       "Q 950 50 662 400 \n",
       "Q 375 750 375 1175 \n",
       "L 950 1175 \n",
       "Q 950 925 1087 725 \n",
       "Q 1225 525 1450 525 \n",
       "Q 1825 525 2012 950 \n",
       "Q 2200 1375 2250 2200 \n",
       "Q 2125 1925 1900 1775 \n",
       "Q 1675 1625 1400 1625 \n",
       "Q 925 1625 625 1975 \n",
       "Q 325 2325 325 2975 \n",
       "Q 325 3625 625 4025 \n",
       "Q 925 4425 1525 4425 \n",
       "Q 2125 4425 2475 3925 \n",
       "Q 2825 3425 2825 2300 \n",
       "z\n",
       "M 2200 2875 \n",
       "Q 2200 3425 2012 3700 \n",
       "Q 1825 3975 1500 3975 \n",
       "Q 1275 3975 1100 3762 \n",
       "Q 925 3550 925 2975 \n",
       "Q 925 2550 1062 2312 \n",
       "Q 1200 2075 1500 2075 \n",
       "Q 1825 2075 2012 2300 \n",
       "Q 2200 2525 2200 2875 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-20\"/>\n",
       "       <use xlink:href=\"#SimHei-39\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"382.6\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 10月 -->\n",
       "      <g transform=\"translate(372.6 243.108437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"SimHei-30\" d=\"M 2975 2250 \n",
       "Q 2975 1350 2650 700 \n",
       "Q 2325 50 1600 50 \n",
       "Q 875 50 537 700 \n",
       "Q 200 1350 200 2250 \n",
       "Q 200 3150 537 3787 \n",
       "Q 875 4425 1600 4425 \n",
       "Q 2325 4425 2650 3787 \n",
       "Q 2975 3150 2975 2250 \n",
       "z\n",
       "M 2375 2250 \n",
       "Q 2375 3050 2187 3500 \n",
       "Q 2000 3950 1600 3950 \n",
       "Q 1200 3950 1000 3500 \n",
       "Q 800 3050 800 2250 \n",
       "Q 800 1450 1000 987 \n",
       "Q 1200 525 1600 525 \n",
       "Q 2000 525 2187 987 \n",
       "Q 2375 1450 2375 2250 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_11\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"419.8\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 11月 -->\n",
       "      <g transform=\"translate(409.8 243.108437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-31\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_12\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m31a22ed532\" x=\"457\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 12月 -->\n",
       "      <g transform=\"translate(447 243.108437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-6708\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <defs>\n",
       "       <path id=\"m23726a4c75\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"228.96\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(17.2 232.377969) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"202.821386\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- 25 -->\n",
       "      <g transform=\"translate(12.2 206.239355) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-32\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"176.682772\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- 50 -->\n",
       "      <g transform=\"translate(12.2 180.100741) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-35\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"150.544158\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_16\">\n",
       "      <!-- 75 -->\n",
       "      <g transform=\"translate(12.2 153.962127) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-37\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"124.405545\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_17\">\n",
       "      <!-- 100 -->\n",
       "      <g transform=\"translate(7.2 127.823513) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"98.266931\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_18\">\n",
       "      <!-- 125 -->\n",
       "      <g transform=\"translate(7.2 101.684899) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"72.128317\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_19\">\n",
       "      <!-- 150 -->\n",
       "      <g transform=\"translate(7.2 75.546286) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"45.989703\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_20\">\n",
       "      <!-- 175 -->\n",
       "      <g transform=\"translate(7.2 49.407672) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-31\"/>\n",
       "       <use xlink:href=\"#SimHei-37\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-35\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m23726a4c75\" x=\"29.2\" y=\"19.851089\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_21\">\n",
       "      <!-- 200 -->\n",
       "      <g transform=\"translate(7.2 23.269058) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#SimHei-32\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"50\"/>\n",
       "       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_15\">\n",
       "    <path d=\"M 29.2 228.96 \n",
       "L 29.2 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_16\">\n",
       "    <path d=\"M 475.6 228.96 \n",
       "L 475.6 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_17\">\n",
       "    <path d=\"M 29.2 228.96 \n",
       "L 475.6 228.96 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_18\">\n",
       "    <path d=\"M 29.2 7.2 \n",
       "L 475.6 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pc95f63a0a0\">\n",
       "   <rect x=\"29.2\" y=\"7.2\" width=\"446.4\" height=\"221.76\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1600x800 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 绘制柱状图\n",
    "plt.figure(figsize=(8, 4), dpi=200)\n",
    "df.plot(ax=plt.gca(), kind='bar', y='合计', legend=False)\n",
    "plt.xticks(rotation=0)\n",
    "plt.savefig('aa.png')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a5236f7-072b-466c-9be3-afbab394f5cb",
   "metadata": {},
   "source": [
    "### 魔法指令"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d5c6a18b-2863-4855-8ef7-2c0aa99b7d5c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看当前工作路径 - print working directory\n",
    "%pwd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "80a9f9e0-1528-40cf-910c-f3c8e5e7e3b9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看指定路径文件列表 - list directory contents\n",
    "%ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "620a54ed-9c29-4058-9d20-c4df72ba4c62",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 执行系统命令\n",
    "%system date"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "659215ed-113a-4d8f-9036-0fcf47c96021",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 保存运行过的代码\n",
    "%save temp.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8fc9c4e4-1423-40f3-b4ee-db2ba2e5d125",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 加载文件内容到单元格\n",
    "%load temp.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "58a08283-561c-43d4-8db6-74cde401b8a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 统计代码执行时间\n",
    "%timeit (1, 2, 3, 4, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "22a271ab-3f5c-4167-b89e-66a31e891cbd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看历史输入\n",
    "%hist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d4ffa792-f1a0-4be9-b2aa-642ee0b9a1ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看魔法指令\n",
    "%lsmagic"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a15db907-c068-41d7-a24c-8f1c5c20d4ec",
   "metadata": {},
   "source": [
    "### 获取帮助"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e037694-9357-46b9-864a-c5f93e1aa8c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "np.random?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "11a97abd-d73d-493e-b727-9c4ded3e5060",
   "metadata": {},
   "outputs": [],
   "source": [
    "np.random.normal?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "66503921-cd69-4394-80ea-7fecf6ecdc33",
   "metadata": {},
   "outputs": [],
   "source": [
    "np.random.r*?"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
